package org.imis.action;

import java.util.List;
import java.util.Map;

import org.imis.service.NewsManage;

import com.opensymphony.xwork2.ActionContext;

public class FindAllTeach {
	private NewsManage newsManage;
    private String check;
    public String getCheck() {
		return check;
	}
	public void setCheck(String check) {
		this.check = check;
	}

	private Map request; 
    private String pageN;
	public String getPageN() {
		return pageN;
	}
	public void setPageN(String pageN) {
		this.pageN = pageN;
	}
	public NewsManage getNewsManage() {
		return newsManage;
	}
	public void setNewsManage(NewsManage newsManage) {
		this.newsManage = newsManage;
	}
	
	public String execute() throws ClassNotFoundException
	{
		request = (Map)ActionContext.getContext().get("request");  
		List<Object> list = newsManage.findNewsByPage("from Teach", Integer.parseInt(pageN), 5, 5);
		request.put("count", newsManage.findNewsCount(Class.forName("org.imis.domain.Teach")));
		request.put("list", list);
		if(check==null)
		{}
		else if(check.equals("q"))
		{
			return "qsuccess";
		}
		return "success";
		
	}



}
